package com.kanqiubao.kq.fragment.live;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import androidx.recyclerview.widget.LinearLayoutManager;

import com.kanqiubao.kq.R;
import com.kanqiubao.kq.adapter.live.LiveZbListAdatper;
import com.kanqiubao.kq.fragment.SmartBaseRefreshFragment;
import com.kanqiubao.kq.view.SpacesItemDecoration;

public class LiveDetailFragmentTwo extends SmartBaseRefreshFragment<String> implements View.OnClickListener {
    @Override
    protected int getLayoutId() {
        return R.layout.live_detail_fragment2_layout;
    }

    @Override
    protected void initData() {
        addHeadver();
        mSuperBaseAdapter.addData(test());
    }

    @Override
    protected void initView() {
        mSuperBaseAdapter = new LiveZbListAdatper();
        super.initView();
        mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
        mSmartRefreshLayout.setEnableLoadMore(false);
        mSmartRefreshLayout.setEnableRefresh(false);
        mRecyclerView.addItemDecoration(new SpacesItemDecoration(getResources().getDimensionPixelOffset(R.dimen.space_12)));

    }

    TextView mGzText;

    private void addHeadver() {
        View v = LayoutInflater.from(getActivity()).inflate(R.layout.live_detail_zb_item_head_layout, null);
        mSuperBaseAdapter.addHeaderView(v);
        mGzText = v.findViewById(R.id.add_gz_id);
        mGzText.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.add_gz_id:
                changeGzType(0);
                break;
        }

    }

    private void changeGzType(int i) {
        if (i == 0) {
            mGzText.setBackgroundResource(R.drawable.live_detail_zb_item_head_not_gz_bg);
        } else {
            mGzText.setBackgroundResource(R.drawable.live_detail_zb_item_head_gz_bg);
        }
    }
}
